<html>
<head>
    <meta charset="UTF-8">
    <title>新增站点</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="../../layui/css/layui.css" />
    <link rel="stylesheet" href="../../css/bass.css" />
	<link rel="stylesheet" href="../../css/city-picker.css"/>
    <style>
        .layui-form{
            width:35%;
        }
        .layui-input{
            width: 100% !important;
        }
    </style>
</head>

<body>
<div class="body">
    <header class="layui-nav" id="headerTop"></header>
    <div class="left_muen" id="left_menu"></div>
    <div class="content_body">
        <!--标题栏-->
        <p class="content_title">站点管理 &nbsp;&nbsp;>&nbsp;&nbsp;站点列表&nbsp;&nbsp;>&nbsp;&nbsp;新增站点</p>
        <!--标题栏-->
        <form class="layui-form mt20">
            <div class="layui-form-item">
                <label class="layui-form-label">序号</label>
                <div class="layui-input-block">
                    <input type="text" name="siteIndex" lay-verify="required|number" autocomplete="off" placeholder="请输入序号" class="layui-input w30">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">站点名称</label>
                <div class="layui-input-block">
                    <input type="text" name="siteName" lay-verify="required" placeholder="请输入站点名称" autocomplete="off" class="layui-input w30">
                </div>
            </div>
            <div class="layui-form-item">
                    <label class="layui-form-label">类型</label>
                    <div class="layui-input-block">
                        <select name="siteType" lay-verify="required" lay-search="">
                            <option value="0">门店</option>
                            <option value="1">调压站</option>
                            <option value="2">LNG站</option>
                            <option value="3">电厂</option>
                            <option value="4">直供用户</option>
                        </select>
                    </div>
            </div>
            <!--<div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">上级站点</label>
                    <div class="layui-input-block">
                        <select name="siteType" lay-verify="required" lay-search="">
                            <option value="0">请选择上级站点</option>
                            <option value="1">调压站</option>
                            <option value="2">LNG站</option>
                            <option value="3">电厂</option>
                            <option value="4">直供用户</option>
                        </select>
                    </div>
                </div>
            </div>-->
            <div class="layui-form-item">
                    <label class="layui-form-label">日气量来源</label>
                    <div class="layui-input-block">
                        <select name="daySource" lay-verify="required" lay-search="">
                            <option value="0">请选择日气量来源</option>
                            <option value="1">占仪表日计量数据</option>
                            
                        </select>
                    </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">计量日偏移</label>
                <div class="layui-input-block">
                    <input type="text" name="dayDeviation" lay-verify="required|number" placeholder="请输入计量日偏移" autocomplete="off" class="layui-input w30">
                </div>
            </div>
            <div class="layui-form-item">
                    <label class="layui-form-label">运输类型</label>
                    <div class="layui-input-block">
                        <select name="transportType" lay-verify="required" lay-search="">
                            <option value="">请选择运输类型</option>
                            <option value="1">天然气管线</option>
                        </select>
                    </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">描述</label>
                <div class="layui-input-block">
                    <input type="text" name="siteDesc" lay-verify="" placeholder="请输入描述" autocomplete="off" class="layui-input w30">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">时段分割点</label>
                <div class="layui-input-block">
                    <input type="text" name="timeIntervalPoint" lay-verify="required" placeholder="请输入时段分割点/分钟" autocomplete="off" class="layui-input w30">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">经度</label>
                <div class="layui-input-block">
                    <input type="text" name="siteLongitude" lay-verify="required|number" placeholder="请输入站点经度" autocomplete="off" class="layui-input w30">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">纬度</label>
                <div class="layui-input-block">
                    <input type="text" name="siteLatitude" lay-verify="required|number" placeholder="请输入站点纬度" autocomplete="off" class="layui-input w30">
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <div class="layui-btn" lay-submit="" lay-filter="submitFilter">立即提交</div>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
<script src="../../js/common/jquery-1.11.3.min.js"></script>
<script src="../../layui/layui.js"></script>
<script src="../../js/common/navList.js"></script>
<script src="../../js/common/ajax.js"></script>
<script src="../../js/city-picker.data.js"></script>
<script src="../../js/city-picker.js"></script>
<script src="../../js/main.js"></script>
<script>
    layui.use(['form', 'layedit'], function() {
        var form = layui.form,layer = layui.layer,layedit = layui.layedit;
        //监听提交
        form.on('submit(submitFilter)', function(data) {
            console.log(data.field)
            ajaxPost({
                url: 'site/add',
                data: {
                    siteIndex: data.field.siteIndex,
                    siteName: data.field.siteName,
                    siteType: data.field.siteType,
                    siteDesc: data.field.siteDesc,
                    daySource:data.field.daySource,
                    dayDeviation:data.field.dayDeviation,
                    transportType:data.field.transportType,
                    timeIntervalPoint:data.field.timeIntervalPoint,
                    siteLongitude:data.field.siteLongitude,
                    siteLatitude:data.field.siteLatitude
                },
                successFull: function(res) {
                    console.log(res)
                    layer.msg('添加成功', {
                        icon: 6
                    });
                    window.location.href = "./zhandianList.html?pos=1&childPos=0";
                },
                errCallBack: function(res) {
                    layer.msg(res.msg, {
                        icon: 6
                    });
                }
            })
        });
    });
</script>
</body>
</html>